package com.jxc.action.kcgl;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import com.jxc.action.BaseAction;
import com.jxc.model.vo.VDamagelist;
import com.jxc.model.vo.VDamagelistItem;
import com.jxc.service.DamagelistItemServiceI;
import com.jxc.service.DamagelistServiceI;
import com.opensymphony.xwork2.ModelDriven;

/**
 * 库存调拨明细
 * 
 * @author Tino
 * 
 */
@Namespace("/kcgl")
@Action(value = "goodsDamageItemAction", results = { @Result(name = "goodsDamageItemAdd", location = "/amountRelate/goodsDamageItemAdd.jsp"),
		@Result(name = "goodsDamageItemEdit", location = "/amountRelate/goodsDamageItemEdit.jsp") })
public class GoodsDamageItemAction extends BaseAction implements ModelDriven<VDamagelist> {
	private final static Logger logger = Logger.getLogger(GoodsDamageItemAction.class);

	private VDamagelist model = new VDamagelist();

	@Autowired
	private DamagelistServiceI damagelistService;
	@Autowired
	private DamagelistItemServiceI damagelistItemService;

	public void noAuth_datagrid() {
		VDamagelistItem item = new VDamagelistItem();
		item.setDlid(model.getId());
		this.writeJson(this.damagelistItemService.datagrid(item));
	}

	public String goodsDamageItemAdd() {
		return "goodsDamageItemAdd";
	}

	public String goodsDamageItemEdit() {
		this.getRequest().setAttribute("id", model.getId());
		return "goodsDamageItemEdit";
	}

	@Override
	public VDamagelist getModel() {
		return model;
	}

}
